/*
 * ROM contents of К145ИК1302 system controller.
 * Using data from emu145 project by Felix Lazarev:
 * https://code.google.com/p/emu145/
 */
static const unsigned int ik1302_ucmd_rom[] = {
    0x0000000, 0x0800001, 0x0A00820, 0x0040020,
    0x0A03120, 0x0203081, 0x0A00181, 0x0803800,
    0x0818001, 0x0800400, 0x0A00089, 0x0A03C20,
    0x0800820, 0x0080020, 0x0800120, 0x1400020,
    0x0800081, 0x0210801, 0x0040000, 0x0058001,
    0x0808001, 0x0A03081, 0x0A01081, 0x0A01181,
    0x0040090, 0x0800401, 0x0A00081, 0x0040001,
    0x0800801, 0x1000000, 0x0800100, 0x1200801,
    0x0013C01, 0x0800008, 0x0A00088, 0x0010200,
    0x0800040, 0x0800280, 0x1801200, 0x1000208,
    0x0080001, 0x0A00082, 0x0A01008, 0x1000001,
    0x0A00808, 0x0900001, 0x8010004, 0x0080820,
    0x0800002, 0x0140002, 0x0008000, 0x0A00090,
    0x0A00220, 0x0801001, 0x1203200, 0x4800001,
    0x0011801, 0x1008001, 0x0A04020, 0x4800801,
    0x0840801, 0x0840020, 0x0013081, 0x0010801,
    0x0818180, 0x0800180, 0x0A00081, 0x0800001,
};

static const unsigned int ik1302_cmd_rom[256] = {
    0x00204E4E, 0x00117360, 0x00114840, 0x01040240,
    0x00164040, 0x001B3240, 0x00064640, 0x015B4013,
    0x00D93130, 0x00001040, 0x01A52014, 0x00000000,
    0x00000000, 0x00000000, 0x00000000, 0x00C12040,
    0x00D0536D, 0x00517740, 0x00B43130, 0x00B22223,
    0x00C15340, 0x00FD2040, 0x002D1D1D, 0x0008403B,
    0x00092140, 0x00094061, 0x000A2140, 0x00082140,
    0x000D7076, 0x010D400D, 0x000A403B, 0x00056D40,
    0x00100259, 0x010B1340, 0x00242044, 0x010B7840,
    0x00064002, 0x01FF2008, 0x0008565A, 0x0126403F,
    0x016C400D, 0x00C12077, 0x00517740, 0x00517740,
    0x00083240, 0x010C400D, 0x01FF200A, 0x010B3568,
    0x00117B5A, 0x0021206D, 0x01222034, 0x01015C5B,
    0x01D03454, 0x00005E5D, 0x010E400D, 0x010E0044,
    0x00F44E40, 0x009A206D, 0x00F44E5A, 0x00000000,
    0x00000000, 0x00000000, 0x00000000, 0x00C11D1D,
    0x00063333, 0x010B403B, 0x01344043, 0x00096A6A,
    0x000A4443, 0x00792120, 0x01D32047, 0x00081E1E,
    0x01AF1140, 0x00AB1D1D, 0x0039324C, 0x000B324C,
    0x0008326D, 0x000D404C, 0x00854D40, 0x00134040,
    0x0009404C, 0x006D7770, 0x006D7240, 0x01001640,
    0x00A54C7E, 0x00F44E40, 0x01536900, 0x000A580E,
    0x003C5262, 0x0005716D, 0x013C4013, 0x00104070,
    0x00056F6D, 0x00A62070, 0x00106F40, 0x01056F40,
    0x001F3E3D, 0x0028595A, 0x001E2223, 0x00064B40,
    0x00524A40, 0x00692120, 0x001B4940, 0x00093240,
    0x011F0140, 0x00154840, 0x00062423, 0x00062423,
    0x01057340, 0x015E400D, 0x00095828, 0x00092223,
    0x00992F40, 0x00982F40, 0x00622040, 0x005D5820,
    0x00740F40, 0x00B81C20, 0x00D05373, 0x005B205C,
    0x006D2062, 0x0133200A, 0x010B7D62, 0x00A52120,
    0x01054072, 0x01494013, 0x01040540, 0x00217362,
    0x013D6A40, 0x00067840, 0x01AB6C6D, 0x01332014,
    0x000E7C6C, 0x00050B3F, 0x00C15340, 0x00950853,
    0x00E0417A, 0x00E04240, 0x00532120, 0x00365562,
    0x008F1E20, 0x013D1740, 0x004C2120, 0x0170406A,
    0x00C05340, 0x00061D1D, 0x00814545, 0x00063333,
    0x00061E1E, 0x00091E1E, 0x00900720, 0x01514078,
    0x00081D1D, 0x01622206, 0x001E4545, 0x00114060,
    0x000B2E40, 0x000F2D40, 0x010E1F40, 0x000D7677,
    0x00D33C40, 0x01D32032, 0x00116E60, 0x011D3440,
    0x00FF7440, 0x00073240, 0x001B430A, 0x01D32047,
    0x00113434, 0x001E6E40, 0x00D33C40, 0x00937540,
    0x00D01E20, 0x00043277, 0x00CA4020, 0x00107F54,
    0x00212068, 0x000B7840, 0x017C400C, 0x00056F6D,
    0x01470C40, 0x01716B62, 0x006B2120, 0x00332120,
    0x006D204C, 0x00E67362, 0x010D0940, 0x00062423,
    0x001A3A3A, 0x018F406F, 0x0151334C, 0x010D1716,
    0x01D35340, 0x00D24061, 0x00CA6554, 0x00104064,
    0x00512223, 0x00782120, 0x00263130, 0x001E3434,
    0x00193838, 0x00183939, 0x000D6654, 0x010D7A40,
    0x010E1740, 0x00057340, 0x00B86140, 0x00045263,
    0x00122773, 0x008F5373, 0x002E5150, 0x0151404C,
    0x001E3737, 0x00894E40, 0x001E3636, 0x006D563D,
    0x00E07A41, 0x00E12973, 0x00082640, 0x00062540,
    0x00D87967, 0x0005565A, 0x0005286C, 0x00762041,
    0x00952040, 0x008F1D1D, 0x01D35340, 0x008F2040,
    0x00CC4F4F, 0x00114060, 0x00054040, 0x001E3434,
    0x01047340, 0x011E3434, 0x00C62C2B, 0x00C53130,
    0x003E1D1D, 0x01041740, 0x001E3535, 0x00D35353,
    0x00DE4077, 0x00E24057, 0x00064E68, 0x01E53812,
    0x00D84067, 0x00064069, 0x000A402A, 0x00EF202A,
    0x01015C5B, 0x00090F40, 0x00005E5D, 0x010B3613,
    0x00144740, 0x01176806, 0x000A5A5A, 0x01D3200D,
};

static const unsigned char ik1302_prog_rom[128*9] = {
    0,    0,    0,    0x10, 0x03, 0x1D, 0,    0x07, 0x1E, //0
    0x10, 0x03, 0x1C, 0x0B, 0x07, 0x0C, 0x1E, 0,    0,    //1
    0x15, 0x18, 0x09, 0x16, 0x18, 0x09, 0x16, 0x18, 0x24,
    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0x03, 0x0E, 0x1E, 0x33, 0,    0,    0,    0,
    0x23, 0,    0,    0,    0x2F, 0,    0x2C, 0,    0x01,
    0x11, 0x32, 0,    0,    0,    0x03, 0,    0x0E, 0x1A,
    0x0F, 0x0E, 0x0D, 0x19, 0x03, 0x2F, 0x0E, 0x0D, 0x08,
    0x1C, 0x0C, 0x0D, 0x01, 0,    0,    0x03, 0x24, 0x0F,
    0x1C, 0x0C, 0x2F, 0x09, 0x1E, 0x34, 0x0E, 0x1E, 0x0C,
    0x06, 0x0A, 0x0D, 0,    0,    0,    0,    0x09, 0x0F,
    0x38, 0,    0,    0,    0,    0,    0x0A, 0x26, 0x06,
    0x35, 0x34, 0x0D, 0x24, 0x1E, 0x1A, 0x09, 0x0C, 0x0F,
    0x3D, 0,    0,    0x1C, 0x03, 0x0E, 0x0A, 0x0F, 0x06,
    0x3D, 0,    0x0E, 0x3F, 0x03, 0x01, 0,    0,    0x0E,
    0x3F, 0x33, 0x0D, 0x01, 0x08, 0,    0x01, 0x08, 0x04,
    0x06, 0x03, 0x0E, 0x2B, 0x3A, 0x09, 0x12, 0x1E, 0x33,
    0x35, 0x03, 0x07, 0x0C, 0x1E, 0x1A, 0,    0,    0,
    0x35, 0x0C, 0x2F, 0x0E, 0x03, 0x01, 0,    0,    0x15,
    0x24, 0x1E, 0x1A, 0x23, 0x1D, 0,    0,    0,    0,
    0x09, 0x0C, 0x2F, 0x09, 0x03, 0,    0x24, 0x0C, 0x0F,
    0x3D, 0x09, 0x1E, 0x3F, 0x03, 0x07, 0x0B, 0x22, 0x03,
    0x07, 0x0B, 0x0D, 0x0C, 0x03, 0x0E, 0x1E, 0x3A, 0x2B,
    0x3C, 0x03, 0,    0x09, 0x34, 0x0E, 0x1E, 0x0C, 0x1E,
    0x2E, 0x01, 0x31, 0x2E, 0x01, 0x31, 0,    0,    0,
    0x2E, 0x30, 0x03, 0x2E, 0x30, 0x03, 0,    0,    0,
    0x2E, 0x2D, 0,    0x2E, 0x2D, 0,    0,    0,    0,
    0x3B, 0x04, 0x2F, 0x37, 0x12, 0,    0,    0,    0,
    0x14, 0,    0,    0x08, 0,    0,    0,    0,    0,
    0x01, 0x13, 0,    0x01, 0x13, 0,    0x01, 0x13, 0x04,
    0x2E, 0,    0,    0x2E, 0,    0,    0x2E, 0,    0,
    0x3D, 0x07, 0x10, 0x3F, 0x03, 0,    0x2C, 0x07, 0x1E,
    0,    0,    0,    0,    0,    0,    0,    0,    0x04,
    0,    0x0F, 0x10, 0x03, 0,    0x1C, 0x03, 0x0F, 0x1D,
    0x03, 0x32, 0,    0x2B, 0x14, 0,    0,    0x08, 0,
    0x04, 0x14, 0,    0,    0x32, 0,    0,    0x32, 0x0C,
    0x0A, 0x32, 0,    0,    0x32, 0,    0,    0x32, 0,
    0x21, 0x15, 0x18, 0x21, 0x16, 0x18, 0,    0x17, 0x18,
    0x19, 0x1A, 0x18, 0x19, 0x16, 0x18, 0x09, 0x16, 0x18,
    0x2B, 0x15, 0,    0,    0x17, 0,    0,    0x17, 0,
    0x12, 0x1B, 0x0E, 0x0F, 0x1B, 0x0E, 0x23, 0x2B, 0x0A,
    0x2C, 0x18, 0,    0x2A, 0x18, 0x07, 0x0B, 0x03, 0x04,
    0x32, 0x14, 0,    0x32, 0x32, 0x11, 0,    0x08, 0,
    0x09, 0x0C, 0x15, 0x03, 0,    0,    0x06, 0x3C, 0,
    0,    0x2C, 0,    0,    0x2A, 0,    0x09, 0x16, 0,
    0,    0,    0x11, 0,    0x09, 0x16, 0x18, 0x09, 0x1E,
    0,    0,    0x07, 0x0A, 0x29, 0x3E, 0x33, 0x29, 0,
    0x0F, 0x0B, 0x0F, 0x10, 0x03, 0x08, 0x24, 0x03, 0x23,
    0x32, 0x01, 0x1D, 0x32, 0x08, 0,    0x32, 0x08, 0x32,
    0x32, 0x08, 0x23, 0x32, 0x08, 0x0F, 0x23, 0x23, 0x04,
    0x09, 0x1E, 0x0F, 0,    0,    0x14, 0,    0,    0x08,
    0x37, 0,    0,    0x37, 0,    0,    0x37, 0,    0,
    0x01, 0x31, 0,    0x01, 0x31, 0,    0x01, 0x31, 0x36,
    0x1A, 0x30, 0x0D, 0,    0x30, 0x0D, 0,    0x30, 0x0D,
    0x30, 0x03, 0,    0x30, 0x03, 0,    0x30, 0x03, 0x2B,
    0x2D, 0,    0,    0x2D, 0,    0,    0x2D, 0,    0,
    0x0A, 0x30, 0x03, 0,    0x30, 0x03, 0,    0x30, 0x03,
    0,    0x01, 0x31, 0,    0x01, 0x31, 0,    0x01, 0x31,
    0,    0x2D, 0,    0,    0x2D, 0,    0,    0x2D, 0,
    0x2C, 0,    0,    0x2A, 0,    0,    0x09, 0x18, 0,
    0x07, 0x1E, 0x0F, 0x01, 0,    0x08, 0x1C, 0x0A, 0x08,
    0x14, 0,    0,    0x32, 0,    0,    0x32, 0x2B, 0,
    0x32, 0,    0,    0x32, 0x27, 0x36, 0x08, 0x09, 0x0C,
    0x1E, 0x02, 0x1D, 0x0F, 0x0C, 0x0F, 0x26, 0x07, 0x22,
    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0x1D, 0x23, 0x23, 0x09, 0x23, 0x0C, 0x03, 0x23, 0x23,
    0x02, 0x35, 0x03, 0x0F, 0,    0,    0,    0x04, 0x0C,
    0x01, 0x12, 0,    0x08, 0,    0x32, 0x0A, 0,    0,
    0x06, 0x18, 0,    0x17, 0x18, 0,    0x17, 0x18, 0,
    0,    0x01, 0x13, 0,    0x01, 0x13, 0x04, 0x01, 0x13,
    0,    0,    0,    0x09, 0x15, 0x18, 0,    0x35, 0x03,
    0x0E, 0x03, 0x09, 0x0C, 0x1B, 0x1E, 0x0F, 0x1B, 0x08,
    0,    0,    0x1C, 0x03, 0x1E, 0x15, 0x02, 0x0C, 0,
    0x07, 0x1E, 0x10, 0x0F, 0x09, 0x32, 0x1E, 0x0F, 0x08,
    0x09, 0x1E, 0x1A, 0x18, 0x1D, 0x17, 0x03, 0x0F, 0x3D,
    0x07, 0x0B, 0x1A, 0x1D, 0x28, 0,    0x0E, 0x28, 0x08,
    0,    0,    0,    0,    0,    0x06, 0x03, 0,    0x09,
    0,    0x04, 0x2B, 0x23, 0x04, 0x08, 0x08, 0,    0x08,
    0x0E, 0x03, 0,    0x2B, 0x2F, 0x0D, 0x12, 0x03, 0x04,
    0x01, 0x08, 0,    0x01, 0x08, 0,    0x01, 0x08, 0x04,
    0x0F, 0x1D, 0x2F, 0x0E, 0x03, 0x23, 0x07, 0x1E, 0x0D,
    0x0F, 0x12, 0,    0x23, 0x24, 0x1E, 0x23, 0x0F, 0x04,
    0x26, 0x12, 0x15, 0x03, 0x12, 0x04, 0x24, 0x2F, 0x0F,
    0x12, 0x04, 0x01, 0x0F, 0x07, 0x1E, 0x0F, 0,    0x01,
    0x0E, 0x0F, 0x20, 0x05, 0,    0x07, 0x12, 0x0E, 0x08,
    0x1E, 0,    0x10, 0x03, 0x0F, 0x04, 0,    0,    0,
    0x32, 0,    0,    0x32, 0,    0,    0,    0x03, 0,
    0,    0,    0x01, 0,    0,    0x05, 0,    0x17, 0x0D,
    0,    0,    0,    0x0A, 0x1A, 0x18, 0,    0x17, 0x03,
    0x32, 0x09, 0x0F, 0x32, 0x07, 0x0C, 0x0C, 0x1A, 0x0F,
    0x14, 0,    0,    0x32, 0,    0,    0x32, 0,    0,
    0x0E, 0x1E, 0x15, 0,    0,    0x02, 0,    0,    0x02,
    0,    0x0E, 0x08, 0x0E, 0x1D, 0x23, 0x1E, 0x3A, 0x3A, //wa
    0x1D, 0x04, 0x15, 0,    0,    0x3A, 0,    0,    0x3A, //wait 4 press
    0,    0,    0x3A, 0,    0x0D, 0x0E, 0x03, 0x0F, 0,
    0x3B, 0x3C, 0x2F, 0x37, 0x3C, 0x01, 0,    0,    0,
    0,    0,    0,    0,    0x30, 0,    0x02, 0x24, 0x1E,
    0,    0,    0,    0,    0x07, 0x0B, 0x22, 0x03, 0x04,
    0,    0,    0x39, 0x04, 0x25, 0x08, 0x03, 0x07, 0x0F, //. 108  //6c
    0x12, 0x2C, 0,    0x2B, 0x2A, 0x26, 0x0D, 0x07, 0x0F,
    0x04, 0x0B, 0x08, 0x01, 0x10, 0x0D, 0x09, 0,    0,
    0,    0x01, 0x08, 0x04, 0x01, 0x08, 0x23, 0x01, 0x08,
    0,    0,    0x1B, 0,    0,    0x1B, 0x1F, 0x0E, 0x1B,
    0,    0,    0,    0,    0,    0x2C, 0,    0x1B, 0,
    0,    0,    0x01, 0x0F, 0x0D, 0x01, 0x09, 0x1E, 0x2B,
    0,    0x23, 0x1A, 0x07, 0x1E, 0x0C, 0x0F, 0,    0,
    0x1E, 0x12, 0,    0,    0x12, 0,    0,    0x12, 0x1A,
    0x1E, 0,    0x10, 0x0F, 0x24, 0x1E, 0x34, 0x1D, 0,
    0x02, 0,    0,    0,    0,    0,    0x09, 0x2F, 0x01,
    0,    0,    0,    0,    0,    0,    0x12, 0x09, 0x15,
    0,    0,    0,    0,    0,    0x28, 0,    0,    0x28,
    0,    0,    0x2B, 0,    0,    0,    0x09, 0x0C, 0x23,
    0x24, 0x0C, 0x1E, 0x0F, 0,    0x07, 0x03, 0x0F, 0,
    0,    0,    0x01, 0x0F, 0x07, 0x0B, 0x0F, 0x25, 0x0F, //.123  //7b
    0x0F, 0x04, 0,    0,    0,    0x12, 0x09, 0x0C, 0x12,
    0,    0,    0,    0x12, 0,    0,    0,    0x09, 0x0C,
    0x03, 0,    0,    0,    0x04, 0x32, 0x24, 0x0F, 0x23,
    0x0E, 0x0D, 0,    0,    0,    0,    0x09, 0x1E, 0x1A,
    0x07, 0x0B, 0x0F, 0x07, 0x0C, 0x1E, 0x1A, 0x0F, 0,
    0x0E, 0x0D, 0,    0,    0,    0,    0,    0x04, 0x08,
    0x12, 0,    0x01, 0x0B, 0,    0,    0,    0,    0x09,
    0,    0,    0,    0,    0,    0,    0,    0x06, 0x0B,
    0,    0,    0x12, 0,    0,    0x12, 0x04, 0x0C, 0x12,
    0x32, 0,    0,    0x32, 0,    0,    0x08, 0x36, 0,
    0x02, 0x0D, 0,    0x01, 0x0F, 0x0D, 0,    0x0E, 0x1E,
    0x1E, 0,    0x10, 0x0F, 0x07, 0x0B, 0x34, 0x0F, 0x1D,
    0x1D, 0x04, 0x08, 0x36, 0,    0x08, 0x12, 0,    0,
    0x03, 0x1E, 0x0F, 0x26, 0x0A, 0x02, 0x26, 0x3E, 0x08,
};
